﻿using System;
using IMath;

namespace Math
{
    public class MathOperations : IMathOperations
    {
        public double Add(double a, double b)
        {
            return a + b;
        }

        public double Subtract(double a, double b)
        {
            return a - b;
        }

        public double Multiply(double a, double b)
        {
            return a * b;
        }

        public double Divide(double a, double b)
        {
            if (b == 0)
                throw new DivideByZeroException("除数不能为零！");
            return a / b;
        }
    }
}